# app/models/prediction_history.py
from app.db import db
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from datetime import datetime

class PredictionHistory(db.Model):
    __tablename__ = 'prediction_history'
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, ForeignKey('users.id'))
    user = relationship('User', backref=db.backref('prediction_histories', lazy='dynamic'))
    prediction_time = db.Column(db.DateTime, default=datetime.utcnow)
    report_id = db.Column(db.Integer, ForeignKey('prediction_report.id'))
    report = relationship('PredictionReport', backref=db.backref('prediction_histories', lazy='dynamic'))